//
//  UIBarButtonItem+Extension.swift
//  SinaWeiBo
//
//  Created by ZKJ on 2017/8/28.
//  Copyright © 2017年 ZKJ. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    /*
    // 1.便利构造函数
    convenience init(image:String) {
        self.init()
        let btn = UIButton()
        btn.setImage(UIImage(named: image), for: .normal)
        btn.setImage(UIImage(named: image + "_highlighted"), for: .highlighted)
        btn.sizeToFit()
        self.customView = btn;
    }
     */
    
    // 2.便利构造函数(推荐此种写法)
    convenience init(image:String) {
        let btn = UIButton()
        btn.setImage(UIImage(named: image), for: .normal)
        btn.setImage(UIImage(named: image + "_highlighted"), for: .highlighted)
        btn.sizeToFit()
        self.init(customView: btn)
    }
}
